<?php

class Application_Form_GensetForm extends Zend_Form
{
    private function getSupplier()
    {
        $supplier = new Application_Model_Supplier();
        $supplier = $supplier->fetchAll();
        $supply = array();
        foreach($supplier as $supplier)
        {
            $supply[$supplier->id_supplier] = $supplier->nama_supplier;
        }
        
        return $supply;
    }
    
    public function init()
    {
        $id = new Zend_Form_Element_Hidden('id_genset');
        
        $serial_number = new Zend_Form_Element_Text('serial_number_genset');
        $serial_number->setLabel('Serial Number')->setRequired();
        
        $supplier = new Zend_Form_Element_Select('id_supplier');
        $supplier->setLabel('Supplier')->setRequired()->setMultiOptions($this->getSupplier());
        
        
        $spek = new Application_Form_SpekgensetForm();
        $harga = new Application_Form_HargasewaForm();
        $submit = new Zend_Form_Element_Submit('submit');
        
        $this->addSubForm($spek, 'spesifikasi');
        $this->addSubForm($harga, 'hargasewa');
        $this->addElements(array($submit, $serial_number, $supplier, $id));
        
        
    }


}

